package com.fegin.Hystrix.admin;

import com.fegin.bean.admin.SysLog;
import com.fegin.bean.common.layuiBean.ResultPage;
import com.fegin.bean.common.layuiBean.VoPage;
import com.fegin.client.admin.SysLogFegin;
import com.util.Respons.ResponseUtil;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author 张子艺
 * @packge com.fegin.Hystrix
 * @data 2019-01-16 14:21
 * @project currencycloud
 */
@Component
public class SysLogFeginHystrix implements FallbackFactory<SysLogFegin> {

    @Override
    public SysLogFegin create(Throwable throwable) {
        return new SysLogFegin() {
            @Override
            public ResultPage<SysLog> findLogByPage(VoPage voPage) {
                ResultPage<SysLog> roleResultPage=new ResultPage<>();
                roleResultPage.setMsg("服务器繁忙，请刷新重试...");
                roleResultPage.setCode(1);
                return roleResultPage;
            }

            @Override
            public Map<String, Object> insert(SysLog sysLog) {
                return ResponseUtil.getExceptionMap();
            }
        };
    }
}
